gtk_nuclear_snapshot (GtkSnapshot *snapshot,
double width,
double height,
- double rotation)
+ double rotation,
+ gboolean draw_background)
{
#define RADIUS 0.3
cairo_t *cr;
double size;
- gtk_snapshot_append_color (snapshot,
- &(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 },
- &GRAPHENE_RECT_INIT (0, 0, width, height));
+ if (draw_background)
+ gtk_snapshot_append_color (snapshot,
+ &(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 },
+ &GRAPHENE_RECT_INIT (0, 0, width, height));
size = MIN (width, height);
cr = gtk_snapshot_append_cairo (snapshot,
gtk_nuclear_snapshot (snapshot,
width, height,
- nuclear->rotation);
+ nuclear->rotation,
+ TRUE);
}
static GdkPaintableFlags
void gtk_nuclear_snapshot (GtkSnapshot *snapshot,
double width,
double height,
- double rotation);
+ double rotation,
+ gboolean draw_background);
GdkPaintable * gtk_nuclear_icon_new (double rotation);
-GdkPaintable * gtk_nuclear_animation_new (void);
+GdkPaintable * gtk_nuclear_animation_new (gboolean draw_background);
GtkMediaStream *gtk_nuclear_media_stream_new (void);
#endif /* __PAINTABLE_H__ */
{
GObject parent_instance;
+ gboolean draw_background;
+
/* This variable stores the progress of our animation.
* We just count upwards until we hit MAX_PROGRESS and
* then start from scratch.
/* We call the function from the previous example here. */
gtk_nuclear_snapshot (snapshot,
width, height,
- 2 * G_PI * nuclear->progress / MAX_PROGRESS);
+ 2 * G_PI * nuclear->progress / MAX_PROGRESS,
+ nuclear->draw_background);
}
static GdkPaintable *
/* And finally, we add the simple constructor we declared in the header. */
GdkPaintable *
-gtk_nuclear_animation_new (void)
+gtk_nuclear_animation_new (gboolean draw_background)
{
- return g_object_new (GTK_TYPE_NUCLEAR_ANIMATION, NULL);
+ GtkNuclearAnimation *nuclear;
+
+ nuclear = g_object_new (GTK_TYPE_NUCLEAR_ANIMATION, NULL);
+
+ nuclear->draw_background = draw_background;
+
+ return GDK_PAINTABLE (nuclear);
}
GtkWidget *
gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
- nuclear = gtk_nuclear_animation_new ();
+ nuclear = gtk_nuclear_animation_new (TRUE);
image = gtk_image_new_from_paintable (nuclear);
gtk_window_set_child (GTK_WINDOW (window), image);
g_object_unref (nuclear);
/* We call the function from the previous example here. */
gtk_nuclear_snapshot (snapshot,
width, height,
- 2 * G_PI * nuclear->progress / DURATION);
+ 2 * G_PI * nuclear->progress / DURATION,
+ TRUE);
}
static GdkPaintable *
choices = gtk_flow_box_new ();
gtk_widget_add_css_class (choices, "view");
add_choice (choices, puzzle);
- add_choice (choices, gtk_nuclear_animation_new ());
+ add_choice (choices, gtk_nuclear_animation_new (TRUE));
media = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
gtk_media_stream_set_loop (media, TRUE);
gtk_media_stream_set_muted (media, TRUE);
32, 1,
gtk_widget_get_direction (widget),
0);
- nuclear = gtk_nuclear_animation_new ();
+ nuclear = gtk_nuclear_animation_new (TRUE);
/* get start of buffer; each insertion will revalidate the
* iterator to point to just after the inserted text.